// LEC			March 26, 2021
// STATE SIZE PAPER

// GLOBAL PATHS /////

// Home directory
global ROOT : pwd

global COMPARISONDIR "$ROOT/comparisondata"
cd $ROOT
capture mkdir "comparisondata"

////// BRIDGING DATA ///////////////////////////////////////////////////////////////////

global IDCONT 0
global CAPITAL 1

global STARTYEAR 1816
global ENDYEAR 2017

// ethnicity-930
global INDIRAGG "$ROOT"
global INDIR "$ROOT"

global STATEFILE "CShapesaggClipped.csv"
global AGGSTATEFILE "CShapesaggClipped.csv"
global SEGMENTFILE  "CShapesaggClippedHEGClippedSegments.csv" 
global DYADFILE "CShapesaggClippedDyadic.csv"
global ETHDYADFILE  "CShapesaggClippedDyadicHEGClipped.csv"  

global OUTDIR "$ROOT/bridging/outdir"
global OUTPUTDIR "$ROOT/bridging/output"
capture mkdir "bridging"
capture mkdir $OUTDIR
capture mkdir $OUTPUTDIR
global PREFIX "brdg"

cd $ROOT
do "data_prep1.do"
cd $ROOT
do "data_prep2_bridging.do"
cd $ROOT
do "data_prep3.do"

/*
// add Wimmer and Feinstein data
cd $ROOT
do "data_prep_addWimFein.do"
*/

cd $ROOT
do "analysis_duration_bridging.do"

cd $ROOT
do "analysis_system_bridging.do"


////// BRIDGING DATA HEG PRE-1886 ///////////////////////////////////////////////////////////////////

global IDCONT 0
global CAPITAL 1

global STARTYEAR 1816
global ENDYEAR 2017

// ethnicity-924
global INDIRAGG "$ROOT"
global INDIR "$ROOT"

global STATEFILE "CShapesaggClipped.csv"
global AGGSTATEFILE "CShapesaggClipped.csv"
global SEGMENTFILE  "CShapesaggClippedHEGPre1886ClippedSegments.csv" 
global DYADFILE "CShapesaggClippedDyadic.csv"
global ETHDYADFILE  "CShapesaggClippedDyadicHEGPre1886Clipped.csv"  

global OUTDIR "$ROOT/bridging1886/outdir"
global OUTPUTDIR "$ROOT/bridging1886/output"
cd $ROOT
capture mkdir "bridging1886"
capture mkdir $OUTDIR
capture mkdir $OUTPUTDIR
global PREFIX "brdgfix"

cd $ROOT
do "data_prep1.do"
cd $ROOT
do "data_prep2_bridging.do"
cd $ROOT
do "data_prep3.do"

/*
// add Wimmer and Feinstein data
cd $HOMEDIR
do "data_prep_addWimFein.do"
*/

cd $ROOT
do "analysis_duration_bridging.do"

cd $ROOT
do "analysis_system_bridging.do"


////// CSHAPES WTIH GREG ///////////////////////////////////////////////////////////////////

global IDCONT 0
global CAPITAL 1
global STARTYEAR 1886
global ENDYEAR 2017

// ethnicity-924
global INDIRAGG "$ROOT"
global INDIR "$ROOT"

global STATEFILE "CShapes.csv"
global AGGSTATEFILE "CShapesagg.csv"
// global SEGMENTFILE  "CShapesGREGSegments.csv"
global SEGMENTFILE "CShapesaggGREGSegments.csv"
global DYADFILE "CShapesaggDyadic.csv" 
global ETHDYADFILE  "CShapesaggDyadicGREG.csv"  
 	
global OUTDIR "$ROOT/cshapesgreg/outdir"
global OUTPUTDIR "$ROOT/cshapesgreg/output"
cd $ROOT
capture mkdir "cshapesgreg"
capture mkdir $OUTDIR
capture mkdir $OUTPUTDIR
global PREFIX "cshpgreg"

cd $ROOT
do "data_prep1.do"
cd $ROOT
do "data_prep2_cshapes2.do"
cd $ROOT
do "data_prep3.do"


cd $ROOT
do "data_prep4_cshapes.do"

/*
// add Wimmer and Feinstein data
cd $ROOT
do "data_prep_addWimFein.do"
*/

cd $ROOT
do "analysis_duration_cshapes.do"

cd $ROOT
do "analysis_system_cshapes.do"


////// CSHAPES SOV DATA (DEPENDENCIES REMOVED, ONLY SOV STATES) ////////////////////////

global IDCONT 0
global CAPITAL 0
global STARTYEAR 1886
global ENDYEAR 2017

// ethnicity-924
global INDIRAGG "$ROOT"
global INDIR "$ROOT"

global STATEFILE "CShapessov.csv"
global AGGSTATEFILE "CShapessov.csv"
// global SEGMENTFILE  "CShapessovGeoEPRAggSegments.csv"
global SEGMENTFILE  "CShapessovGREGSegments.csv"
global DYADFILE "CShapessovDyadic.csv" 
// global ETHDYADFILE  "CShapessovDyadicGeoEPRAgg.csv"
global ETHDYADFILE  "CShapessovDyadicGREG.csv"  
 	
global OUTDIR "$ROOT/cshapessov/outdir"
global OUTPUTDIR "$ROOT/cshapessov/output"
cd $ROOT
capture mkdir "cshapessov"
capture mkdir $OUTDIR
capture mkdir $OUTPUTDIR
global PREFIX "cshpsov"

cd $ROOT
do "data_prep1.do"
cd $ROOT
// do "data_prep2_cshapes.do"
do "data_prep2_cshapessov.do"
cd $ROOT
do "data_prep3.do"


cd $ROOT
do "data_prep4_cshapes.do"


/*
// add Wimmer and Feinstein data
cd $ROOT
do "data_prep_addWimFein.do"
*/

cd $ROOT
do "analysis_duration_cshapes_sov.do"

cd $ROOT
do "analysis_system_cshapes_sov.do"


////// CSHAPES WTIH GEO-EPR ///////////////////////////////////////////////////////////////////

global IDCONT 0
global CAPITAL 1
global STARTYEAR 1886
global ENDYEAR 2017

// ethnicity-924
global INDIRAGG "$ROOT"
global INDIR "$ROOT"

global STATEFILE "CShapes.csv"
global AGGSTATEFILE "CShapesagg.csv"
//global SEGMENTFILE  "CShapesGeoEPRAggSegments.csv"
global SEGMENTFILE  "CShapesaggGeoEPRAggSegments.csv"
global DYADFILE "CShapesaggDyadic.csv"
global ETHDYADFILE  "CShapesaggDyadicGeoEPRAgg.csv"

global OUTDIR "$ROOT/cshapes/outdir"
global OUTPUTDIR "$ROOT/cshapes/output"
cd $ROOT
capture mkdir "cshapes"
capture mkdir $OUTDIR
capture mkdir $OUTPUTDIR
global PREFIX "cshp"

cd $ROOT
do "data_prep1.do"
cd $ROOT
do "data_prep2_cshapes2.do"
cd $ROOT
do "data_prep3.do"


cd $ROOT
do "data_prep4_cshapes.do"


/*
// add Wimmer and Feinstein data
cd $ROOT
do "data_prep_addWimFein.do"
*/

cd $ROOT
do "analysis_duration_cshapes.do"

cd $ROOT
do "analysis_system_cshapes.do"




////// CENTENNIA /////////////////////////////////////////////////////////////////////////////

global IDCONT 1
global CAPITAL 0

global STARTYEAR 1816
global ENDYEAR 2003

// ethnicity-924
global INDIRAGG "$ROOT"
global INDIR "$ROOT"

global STATEFILE "CentenniayearlyClipped.csv"
global AGGSTATEFILE "CentenniayearlyClipped.csv"
global SEGMENTFILE  "CentenniaYearlyClippedHEGClippedSegments.csv" 
global DYADFILE "CentenniayearlyClippedDyadic.csv"
global ETHDYADFILE  "CentenniayearlyClippedDyadicHEGClipped.csv"  

global OUTDIR "$ROOT/centennia/outdir"
global OUTPUTDIR "$ROOT/centennia/output"
cd $ROOT
capture mkdir "centennia"
capture mkdir $OUTDIR
capture mkdir $OUTPUTDIR
global PREFIX "cent"

cd $ROOT
do "data_prep1_centennia.do"
cd $ROOT
do "data_prep2_centennia.do"
cd $ROOT
do "data_prep3_centennia.do"

cd $ROOT
do "analysis_duration_bridging.do"

cd $ROOT
do "analysis_system_bridging.do"


////// ABRAMSON WITH HEG 1886 ///////////////////////////////////////////////////////////


global IDCONT 0
global CAPITAL 0

global STARTYEAR 1490
global ENDYEAR 1790

// ethnicity-930
global INDIRAGG "$ROOT"
global INDIR "$ROOT"

global STATEFILE "AbramsonmaxClipped.csv"
global AGGSTATEFILE "AbramsonmaxClipped.csv"
global SEGMENTFILE  "AbramsonmaxClippedHEGPre1886ClippedSegments.csv" 
global DYADFILE "AbramsonmaxClippedDyadic.csv"
global ETHDYADFILE  "AbramsonmaxClippedDyadicHEGPre1886Clipped.csv"  

global OUTDIR "$ROOT/abramsonmax/outdir"
global OUTPUTDIR "$ROOT/abramsonmax/output"
cd $ROOT
capture mkdir "abramsonmax"
capture mkdir $OUTDIR
capture mkdir $OUTPUTDIR
global PREFIX "abrmax"

cd $ROOT
do "data_prep1_abrmax.do"
cd $ROOT
do "data_prep2_abrmax.do"
cd $ROOT
do "data_prep3_abrmax.do"

// add Wimmer and Feinstein data
// cd $HOMEDIR
// do "data_prep_addWimFein.do"

cd $ROOT
do "analysis_duration_abrmax.do"

cd $ROOT
do "analysis_system_abrmax.do"

